<script type="text/javascript">
$(function() {
	$( ".calendar").datepicker();
});
</script>
<%@ include file="/jsp/common/tagLibs.jsp"%>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/admin/bankDetails.js"></script>
<DIV class=content_division>
	<DIV class=content_container>
	<DIV class=cleardiv></DIV>
		<DIV class=content_left_shadow>
			<DIV class=content_right_shadow>
				<DIV class=under_flash_shadow></DIV>
				<!-- CONTENT START -->
				<DIV class=content_inner_container>
							<DIV class=cleardiv></DIV>
						   
							<form:form commandName="bankManagementVO" id="columnarForm">
							<DIV class=cleardiv></DIV>
							<!-- MAINCOL START -->
							<DIV id="leftDiv" class=maincol style="MARGIN-TOP: 20px; width:280px;">
								<div>
									<DIV class=button_orange>
										<DIV class=bo_left></DIV>
										<DIV class=bo_mid>Bank Information</DIV>
										<DIV class=bo_right></DIV>
									</DIV>
									<DIV class=text_container>
											<fieldset style="border:0px;">
												<label for="city1">
													<input type="hidden" name="validation" id="validation"/>
													<c:if test="${not empty bankExist}">
													<span class="error" style="color: red">Bank Code already exist.</span>
													</c:if>
													<c:if test="${not empty updated}">
													<span class="error" style="color: red">Bank updated successfully.</span>
													</c:if>	
												</label>
												<label class="first" for="street1">
													Bank Name:
													<form:input id="bankName" path="bankDetails.bankname" cssClass="input jFocus"/>
													<%-- <input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													Bank Code:
													<c:choose>
													<c:when test="${not empty update}">
													<form:input id="bankCode" path="bankDetails.bankcode" disabled="true" cssClass="input jFocus"  />
													</c:when>
													<c:otherwise>
													<form:input id="bankCode" path="bankDetails.bankcode" cssClass="input jFocus"  />
													</c:otherwise>
													</c:choose>
													<%-- <input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													Contact Person:
													<form:input id="contact" path="bankDetails.contactperson" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													Address:
													<form:input id="houseNumber" path="bankDetails.number" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
													<form:input	path="bankDetails.additionalnumber" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
													<form:input id="street" path="bankDetails.street" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													Phone:
													<form:input id="phone" path="bankDetails.phone" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													Email:
													<form:input id="email" path="bankDetails.email" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													ZIP code:
													<form:input id="zipCode" path="bankDetails.zipcode" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													City:
													<form:input id="city" path="bankDetails.city" cssClass="input jFocus"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>
												<label for="city1">
													Country:
													<form:input id="country" path="bankDetails.country" cssClass="input jFocus"/> 
													<form:hidden path="bankDetails.activeInd" id="bankDetails_activeInd"/>
													<%--<input id="status" name="city1" type="text" value="" class="input jFocus" />--%>
												</label>												
											</fieldset>
									</DIV>
								</div>
							</DIV><!-- MAINCOL END -->
							<!-- RIGHTCOL START -->
							<DIV id="rightDiv" class=rightcol style="width:550px;">
								<DIV class=rightcol_content_spacer></DIV>
								<DIV>
									<DIV>
										<DIV class=button_orange>
											<DIV class=bo_left></DIV>
											<DIV class=bo_mid>Factors and Weightage</DIV>
											<DIV class=bo_right></DIV>
										</DIV>
										<DIV class=text_container>
											<table style="color: #804500;" CELLSPACING="15" >
												<c:forEach items="${bankManagementVO.bankfactors}" var="bankfactor" varStatus="status">
												<c:if test="${status.count=='1'}"> 
												<tr>
													<th></th>	
													<td>Period</td>
													<th>From</th>
													<td>
													<input id="fromdt" type="text" 
													name="bankfactors[${status.index}].fromdt" 
													class="input calendar jFocus" 
													value="<fmt:formatDate pattern="dd/MM/yyyy" value="${bankfactor.fromdt}" />" />
													<%--<input type="text" id="fromDate1" >--%>
													</td>													
													<th>To</th>		
													<td>
													<input id="todt" type="text" 
													name="bankfactors[${status.index}].todt" 
													class="input calendar jFocus" 
													value="<fmt:formatDate pattern="dd/MM/yyyy" value="${bankfactor.todt}" />" />
													<%--<input type="text" id="toDate1" class="input calendar jFocus"> --%>
													</td>																																																	
												</tr>
												</c:if>
												</c:forEach>
												<tr>
													<th></th>
													<th></th>
													<th>SLA</th>
												 	<td>Units</td>
												</tr>
												<c:forEach items="${bankManagementVO.bankfactors}" var="bankfactor" varStatus="status">
												<tr>
													<td>&nbsp;</td>
													<td>
														${bankfactor.factorName} 
														<input type="hidden" name="bankfactors[${status.index}].factorid" id="bankfactors${status.index}_factorid" 
																	value="${bankfactor.factorid}" />	
														<input type="hidden" name="bankfactors[${status.index}].bankcode" id="bankfactors${status.index}_bankcode" 
																	value="${bankfactor.bankcode}" />	
													</td>
													<td>
													<input id="bankfactors_${status.index}_expectedvalue" type="text"
														 name="bankfactors[${status.index}].expectedvalue" value="${bankfactor.expectedvalue}" class="input medium jFocus" >
													<%--<input id="status" name="street1" type="text" value="" class="input medium jFocus" />--%>
													</td> 
													<td>
														${bankfactor.units} 	
													</td>													
													<td style="display: none" nowrap>
													<input id="bankfactors_${status.index}_weightage" type="hidden" 
													name="bankfactors[${status.index}].weightage" value="1" class="input small jFocus" /> %</td>
												</tr>
												</c:forEach>
											</table>
										</DIV>
									</DIV>
								</DIV>
							</DIV>
							<!-- RIGHTCOL END -->
							<DIV class=cleardiv></DIV>
							<div>
								<input type="hidden"/>
								<c:choose>
									<c:when test="${not empty bankManagementVO.bankDetails.bankcode}">
    									<c:if test="${bankManagementVO.bankDetails.activeInd == 'N'}">   									
											<input value="Activate" type="submit" class="button" id="activate"/>    										
    									</c:if>
    									<c:if test="${bankManagementVO.bankDetails.activeInd == 'Y'}">
    										<input value="Update" type="submit" class="button" id="updateBtn"/>     									
											<input value="Deactivate" type="submit" class="button" id="deActivate"/>
    									</c:if>									
									</c:when>
									<c:otherwise>
										<input value="Add" type="submit" class="button" id="addBtn"/>
									</c:otherwise>
								</c:choose>
								<input value="Cancel" type="submit" class="button" id="cancelBtn"/>
							</div>
							<DIV class=cleardiv></DIV>
							</form:form>  
							<br/><br/><br/>
						</DIV>
				<!-- CONTENT END -->
			</DIV>
		</DIV>
		<DIV class=cleardiv></DIV>
	</DIV>
</DIV>